import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class jdbcdemo2_DriverManager {
    public static void main(String[] args) throws Exception{
        Class.forName("com.mysql.jdbc.Driver");
        /*本机MySQL并且端口3306可以简化书写
        String url = "jdbc:mysql://cc";
         */
                String url = "jdbc:mysql://192.168.2.131:3306/cc";
                String username = "root";
                String password = "abc123";
        Connection conn = DriverManager.getConnection(url,username,password);

        String sql = "update account set money = 2000 where id = 1";
        Statement stmt = conn.createStatement();
        int count = stmt.executeUpdate(sql);
        System.out.println(count);
        stmt.close();
        conn.close();
        System.out.println("==============");

    }
}

